import requests
# r = requests.get("https://www.baidu.com")
# # 状态码
# print(r.status_code)
# # 响应体(响应结果)
# print(r.text)
# # 打印响应头
# print(r.headers)

# get = requests.get("https://www.baidu.com")
# post = requests.post("https://www.baidu.com")
# req_get = requests.request("GET", "https://www.baidu.com")
# req_post = requests.request("POST", "https://www.baidu.com")
#
# print("get: ", get.status_code)
# print("post: ", post.status_code)
# print("req_get: ", req_get)
# print("req_post: ", req_post)

# 请求抽奖系统活动页接口
# 必须要先登陆--在请求头添加用户登陆凭证（User_token）
# 带有参数
# url = "http://101.42.27.228:8080/activity/find-list?currentPage=1&pageSize=10"
# 这里的get请求，url上拼接的参数也可以单独拿下来写
# url = "http://101.42.27.228:8080/activity/find-list"
# param = {
#     "currentPage": 1,
#     "pageSize": 10
# }
#
# # 定义请求头
# header = {
#     "user_token": "eyJhbGciOiJIUzI1NiJ9.eyJpZGVudGl0eSI6IkFETUlOIiwiaWQiOjM5LCJpYXQiOjE3NTY5MDA5NzUsImV4cCI6MTc1NjkwNDU3NX0.mU3TP7eTpmjg9qhYVPvnTvLKmcAx2tkc6yJFOpQL4TE"
# }
# r = requests.request("GET", url=url, params=param, headers=header)
# print(r.json())


# 抽奖系统登录接口
# POST 表单格式
# url = "http://101.42.27.228:8080/password/login"
#
# data = {
#     "loginName": "17612932553",
#     "password": "2002lyz",
#     "mandatoryIdentity": "admin"
# }
#
# r = requests.request(method="POST", url=url, json=data)
# print(r.json())

# 论坛系统（心灵树洞）首页
# 添加用户登陆凭证--cookie
url = "http://101.42.27.228:58080/index.html"

cookie = {
    "JSESSIONID": "22A238B96251D02BBADD364452A2DC4D"
}
r = requests.request(method="GET", url=url, cookies=cookie)
print(r.text)
